package com.qut.graduate.busrtquery;

import android.annotation.SuppressLint;

import com.qut.graduate.busrtquery.utils.photoselect.FileUtils;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Locale;

/**
 * @Author WLL
 * @Time: 2019/3/26 17:02
 */
public class BRTQConstant {

    // app名称
    public static final String APP_NAME = "BRTQuery";

    // 青岛新闻网请求地址
    public static final String URL_API_ROUTE = "http://bus.qingdaonews.com/api_route.php"; // 进入应用时就调用
    public static final String URL_LINE_QUERY = "http://bus.qingdaonews.com/m/routes.php?rid="; // 线路查询时调用
    public static final String URL_BUS_REAL_TIME_INFO = "http://bus.qingdaonews.com/m/detail_ajax.php?rid="; // 公交实时信息
    public static final String URL_BUS_LINE_INFO = "http://bus.qingdaonews.com/api_route_info.php?route="; // 公交线路站点信息
//    public static final String URL_BUS_REAL_TIME_INFO = "http://bus.qingdaonews.com/new/api_bus_route.php?routeId="; // 公交实时信息

    // 数据库名称
    public static final String DB_NAME = "BRTQuery_db";
    public static final int DB_TABLE_TYPE_BUS_LINE_HISTORY = 0x99;
    public static final int DB_TABLE_TYPE_BUS_LINE_COLLECT = 0x97;
    public static final int DB_TABLE_TYPE_STATION_INFO_HISTORY = 0x98;
    public static final int DB_TABLE_TYPE_STATION_INFO_COLLECT = 0x96;

    // 数据库插入、更新
    public static final int DB_BUS_LINE_HISTORY_INSERT = 0x99;
    public static final int DB_BUS_LINE_HISTORY_UPDATE = 0x98;
    public static final int DB_STATION_INFO_HISTORY_INSERT = 0x97;
    public static final int DB_STATION_INFO_HISTORY_UPDATE = 0x96;
    public static final int DB_BUS_LINE_COLLECT_INSERT = 0x95;
    public static final int DB_BUS_LINE_COLLECT_UPDATE = 0x94;
    public static final int DB_STATION_INFO_COLLECT_INSERT = 0x93;
    public static final int DB_STATION_INFO_COLLECT_UPDATE = 0x92;

    // 数据库、交互时间格式化
    public static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());

    // http请求 tag
    public static final int HTTP_TAG_API_ROUTE = 0;
    public static final int HTTP_TAG_LINE_QUERY = 1;
    public static final int HTTP_TAG_BUS_REAL_TIME_INFO = 2;
    public static final int HTTP_TAG_BUS_LINE_INFO = 3;
    public static final int HTTP_TAG_BUS_LINE_INFO_HC = 5;
    public static final int HTTP_TAG_BUS_REAL_TIME_INFO_ONLY = 4;

    // 公交方向
    public static final int BUS_DIRECT_UP = 1;
    public static final int BUS_DIRECT_DOWN = 0;

    // 收藏类型
    public static final int COLLECT_BUS_LINE = 0;
    public static final int COLLECT_STATION = 1;

    // Handler message.what类型
    public static final int HANDLER_LINE_QUERY_BUS_ROUTE_LIST = 0;
    public static final int HANDLER_BUS_REAL_TIME_INFO_COUNTDOWN_TIMER = 1;
    public static final int HANDLER_BUS_REAL_TIME_INFO_UPDATE_RECY = 2;

    // stationQuery界面POI检索的类型，0 是查询建议，1 是附近站点检索, 2 是查询更多
    public static final int STATION_QUERY_POI_TYPE_SUGGEST = 0;
    public static final int STATION_QUERY_POI_TYPE_SUGGEST_MORE = 2;
    public static final int STATION_QUERY_POI_TYPE_NEARBY = 1;

    // 选择地点界面POI检索的类型，0 是查询建议，2 是查询更多
    public static final int SELECT_PLACE_POI_TYPE_SUGGEST = 0;
    public static final int SELECT_PLACE_POI_TYPE_SUGGEST_MORE = 1;

    // 图片选择路径相关常量
    // 即 BRTQuery/
    public static final String APP_DIR = APP_NAME + File.separator;
    // 文件夹根目录 即/storage/emulated/0/BRTQuery/
    public static final String ROOT_DIR = FileUtils.getRootPath() + File.separator + APP_DIR;
    // 保存版本更新apk的文件夹根目录 即/storage/emulated/0/BRTQuery/Apk
    public static final String APK_DIR = ROOT_DIR + "Apk" + File.separator;
    // 保存图片文件夹根目录 即/storage/emulated/0/BRTQuery/Image
    public static final String IMAGE_DIR = ROOT_DIR + "Image" + File.separator;
    // 保存拍照后图片的文件夹根目录 即/storage/emulated/0/BRTQuery/Image/Camera
    public static final String CAMERA_DIR = IMAGE_DIR + "Camera" + File.separator;
    // 保存裁剪图片的文件夹根目录 即/storage/emulated/0/BRTQuery/Image/Crop
    public static final String CROP_DIR = IMAGE_DIR + "Crop" + File.separator;
    // 保存用户中心下载图片的文件夹根目录 即/storage/emulated/0/BRTQuery/Image/UserDownload
    public static final String USER_DOWNLOAD_DIR = IMAGE_DIR + "UserDownload" + File.separator;
    // 保存广告下载图片的文件夹根目录 即/storage/emulated/0/BRTQuery/Image/AdDownload
    public static final String AD_DOWNLOAD_DIR = IMAGE_DIR + "AdDownload" + File.separator;

    // 日期格式化
    @SuppressLint("SimpleDateFormat")
    public static final SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMdd_HHmmss");

    // 图片选择相关常量
    public static final int CANCEL = 0; // 取消
    public static final int CAMERA = 1; // 拍照
    public static final int ALBUM = 2; // 相册
    public static final int GET_BY_ALBUM = 0x01; // 相册标记
    public static final int GET_BY_CAMERA = 0x02; // 拍照标记
    public static final int CROP = 0x03; // 裁剪标记
    public static final String CROP_WIDTH = "crop_Width";
    public static final String CROP_HEIGHT = "crop_Height";
    public static final String RATIO_WIDTH = "ratio_Width";
    public static final String RATIO_HEIGHT = "ratio_Height";
    public static final String ENABLE_CROP = "enable_Crop";
    public static final String PICTURE_PATH = "image_Path"; // intent传输图片的key
    public static final int SELECT_HEADER_REQUEST_CODE = 0x01; // 选择用户头像请求码
    public static final int SELECT_HEADER_BG_REQUEST_CODE = 0x02; // 选择用户界面顶部背景请求码

    // 权限请求码
    public static final int PERMISSION_CODE_FIRST = 0x14;
    public static final int PERMISSION_CODE_SECOND = 0x15;
    public static final int PERMISSION_CODE_CHECK = 0x16;
    // 安装apk权限请求码
    public static final int INSTALL_PACKAGES_REQUEST_CODE = 0x17;

    // 主页fragment
    public static final int FRAGMENT_LOC_NAV = 0;
    public static final int FRAGMENT_LINE_QUERY = 1;
    public static final int FRAGMENT_STATION_QUERY = 2;
    public static final int FRAGMENT_TRANSFER_QUERY = 3;

    // 选择地点界面的地点类型
    public static final int SELECT_PLACE_TYPE_START = 0; // 起点
    public static final int SELECT_PLACE_TYPE_END = 1; // 终点

    // 公交路线详情界面recyclerView布局类型
    public static final int BUS_ROUTE_DETAIL_FIRST = 1;
    public static final int BUS_ROUTE_DETAIL_LAST = 2;
    public static final int BUS_ROUTE_DETAIL_WALK = 3;
    public static final int BUS_ROUTE_DETAIL_BUS = 4;
    public static final int BUS_ROUTE_DETAIL_OTHER = 5;

    // 公交路线详情界面recyclerView布局类型
    public static final int BUS_REAL_TIME_STATION_FIRST = 1;
    public static final int BUS_REAL_TIME_STATION_LAST = 2;
    public static final int BUS_REAL_TIME_STATION_MIDDLE = 3;

    // requestCode
    public static final int TRANSFER_GO_TO_SELECT_PLACE = 0; // 换乘界面跳转到选择地点界面

    // resultCode
    public static final int SELECT_PLACE_BACK_TO_TRANSFER = 0; // 选择地点界面跳转回到换乘界面

    // 路径规划类型
    public static final int MASS_TRANSIT_ROUTE = 5;
    public static final int TRANSIT_ROUTE = 4;
    public static final int WALKING_ROUTE = 3;
    public static final int DRIVING_ROUTE = 2;
    public static final int BIKING_ROUTE = 1;

    // 设置界面跳转到便民界面的服务类型
    public static final int CONVENIENT_TYPE_NOTICE = 1;
    public static final int CONVENIENT_TYPE_SUBWAY = 2;
    public static final int CONVENIENT_TYPE_RECHARGE = 3;

    // 导航定位界面显示导航、地点详细信息布局
    public static final int LOC_NAV_SHOW_BOTTOM_LAYOUT = 1;
    public static final int LOC_NAV_HIDE_BOTTOM_LAYOUT = 2;

    // 登录界面布局显示
    public static final int LOGIN_LAYOUT_LOGIN = 1;
    public static final int LOGIN_LAYOUT_REGISTER = 2;
    public static final int LOGIN_LAYOUT_RESET_PWD_PHONE = 3;
    public static final int LOGIN_LAYOUT_LOGIN_EMAIL = 4;
    public static final int LOGIN_LAYOUT_REGISTER_EMAIL = 5;
    public static final int LOGIN_LAYOUT_RESET_PWD_EMAIL = 6;
    public static final int LOGIN_LAYOUT_RESET_PWD = 7;

    // 页面跳转常量
    public static final String FROM_ACTIVITY_MAIN = "from_main_activity";

    // Bmob应用id
    public static final String BMOB_APP_ID = "74484ee79ef10cb552ab13235abbcb70";
    // 上传到Bmob的图片类型
    public static final int BMOB_IMAGE_HEADER = 1;
    public static final int BMOB_IMAGE_BG = 2;
    // Bmob存放图片与本地相同
    public static final int BMOB_IMAGE_HEADER_SAME = 1;
    public static final int BMOB_IMAGE_BG_SAME = 2;
    public static final int BMOB_IMAGE_HEADER_SAVE_PATH = 3;
    public static final int BMOB_IMAGE_BG_SAVE_PATH = 4;

    // 当前网络状态
    public static final int NETWORK_NONE = 0; // 没有网络连接
    public static final int NETWORK_WIFI = 1; // wifi连接
    // 手机网络数据连接类型
    public static final int NETWORK_2G = 2;
    public static final int NETWORK_3G = 3;
    public static final int NETWORK_4G = 4;
    public static final int NETWORK_MOBILE = 5;

}
